package com.example.a2032.db.dao;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import com.example.a2032.entity.EcgSaveInfo;

import java.util.List;

@Dao
public interface EcgSaveInfoDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(EcgSaveInfo ecgSaveInfo);

    @Query("select * from ecgsaveinfo")
    LiveData<List<EcgSaveInfo>> loadAllEcgInfo();



    @Query("select * from ecgsaveinfo where date > :lastUploadDate ORDER BY date DESC")
    List<EcgSaveInfo> getLastEcgData(String lastUploadDate);

    @Query("select * from ecgsaveinfo ORDER BY date DESC")
    List<EcgSaveInfo> getLastEcgData();


    @Update
    void updateEcgData(EcgSaveInfo heartRateData);


}
